﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using EzDesk.Apps.Model.ProjectModule;
using EzDesk.Core.Model;
using EzDesk.Utility.ServiceStatusInfo;

namespace EzDesk.Apps.Interface.ProjectModule
{
    
    public interface IProjectService
    {
        #region [ Workitem ]
        
        StatusInfo<Guid> AddWorkitem(Workitem workItem);

        
        StatusInfo<Guid> AddFinishedWorkitem(Workitem workitem);

        
        StatusInfo UpdateWorkitem(Workitem newWorkitem, Guid actorId);
        
        
        StatusInfo ConfirmWorkItem(Guid workitemId, Guid actorId);

        
        StatusInfo CancelWorkItem(Guid workitemId, Guid actorId);
        
        StatusInfo FinishWorkitem(Guid workitemId, Guid actorId, int points);

        
        StatusInfo PostponeWorkitem(Guid workitemId, DateTime newPlanOn, Guid actorId);

        
        StatusInfo<List<Workitem>> GetWorkitems(
            Guid? ownerId,  // 任务责任人
            Guid? creatorId,  // 任务创建人
            Guid? projectId,  // 所属项目
            Guid? taskId,
            WorkitemStatus? status, //任务状态
            bool? isFinished, // 任务是否完成  
            DateTime? startCreateOn, // 创建时间范围开始
            DateTime? endCreateOn, // 创建时间范围结束  
            DateTime? startFinishOn, // 完成时间范围开始
            DateTime? endFinishOn, // 完成时间范围结束
            int? maxCount, // 最多条数
            bool isAvailable = true//任务是否有效
            );

        
        StatusInfo<List<Workitem>> GetWorkitemsWithoutOwner(Guid userId);

        
        StatusInfo<Workitem> GetWorkitem(Guid workitemId);

        
        StatusInfo<List<Workitem>> GetWorkitemsInProjects(List<Guid> projectList);

        
        StatusInfo CheckTimeoutWorkItems();

        
        StatusInfo SendDailyWorkBlog();

        
        StatusInfo<List<WorkitemStatistics>> GetWorkitemStatistics(string memberstring, DateTime startDay,
                                                                   DateTime endDay);

        void CheckStatisticsReport();
        
        #endregion Workitem

        #region [ DailyWork ]
        
        StatusInfo<DailyWorks> GetDailyWork(Guid userId, DateTime day);
        
        StatusInfo<List<DailyWorks>> GetDailyWorks(Guid userId, DateTime startDate, DateTime endDate);

        
        StatusInfo<DailyWorks> UpdateDailyWorks(Guid userId, DateTime day, string content);
        #endregion

        #region [ Project Info ]

        StatusInfo<Project> CreateNewProject(Project project);

        StatusInfo UpdateProjectBasicInfo(Guid projectId, string projectName, string projectCode, string description, Guid actorId);

        StatusInfo SwitchProjectStatus(Guid projectId, ProjectStatus projectStatus, Guid actorId);

        StatusInfo UpdateProjectMember(Guid projectId, string memberString, Guid actorId);

        StatusInfo<List<Project>> GetProjects(Guid? userId, ProjectStatus[] projectStatus);

        StatusInfo<Project> GetProjectById(Guid projectId);

        
        StatusInfo<Project> GetFullProjectById(Guid projectId);

        
        StatusInfo ChangeProjectStartOn(Guid projectId, DateTime newStartOn, Guid actorId);

        
        
        StatusInfo<List<ProjectTemplate>> GetProjectTemplateList();

        
        StatusInfo<Project> CreateNewProjectWithTemplate(Project project, Guid projectTemplateId, DateTime startOn, Guid actorId);


        
        StatusInfo<ProjectTemplate> CreateProjectTemplate(ProjectTemplate projectTemplate);

        
        StatusInfo RemoveProjectTemplate(Guid id);

        
        StatusInfo<double> GetProjectEndDate(Guid id);

        dynamic GetWorkitemsInProjectForMobile(Guid projectId);
        dynamic GetWorkitemDetailForMobile(Guid workitemId);

        #endregion

        #region Task
        
        StatusInfo<Task> CreateTask(Task task, Guid actorId);
        
        StatusInfo DeleteTask(Guid taskId, Guid actorId);

        StatusInfo UpdateTask(Task newTask, bool? moveChild, Guid actorId);
        
        StatusInfo<List<Workitem>> GetTaskWorkitems(Guid taskId);
        
        StatusInfo<List<Task>> GetPorjectTasks(Guid projectId);

        
        StatusInfo CheckTimeoutTasks();

        
        StatusInfo<List<Task>> GetTasksInProjects(List<Guid> projectIdList);

        
        StatusInfo CreateTaskWithTemplate(Guid projectId, Guid? parentTaskId, Guid taskTemplateId, Guid actorId);
        
        StatusInfo<List<TaskTemplate>> GetTaskTemplateList();
        
        StatusInfo<TaskTemplate> CreateTaskTemplate(TaskTemplate taskTemplate);
        
        StatusInfo RemoveTaskTemplate(Guid id);
        
        #endregion Task

        StatusInfo UpdateWorkitemDescriptionForMobile(Guid workitemId, string description);
        StatusInfo UpdateWorkitemTitleForMobile(Guid workitemId, string title);
        StatusInfo UpdateWorkitemPlanOnForMobile(Guid workitemId, long planOn);
        StatusInfo UpdateWorkitemOwnerForMobile(Guid workitemId, Guid? ownerId, Guid actorId);
        StatusInfo UpdateWorkitemProjectAndTaskForMobile(Guid? projectId, Guid? taskId, Guid? workitemId);

        StatusInfo<List<SimpleUser>> GetProjectMembers(Guid projectId);

        
        void TestApns(string deviceToken, string body, string workitemId);
        StatusInfo<List<NotificationForAndroid>> getFeedsForAndroid(Guid currentUserId);

        StatusInfo cancelFeeds(List<Guid> idList);
    }
}
